//
//  CommonHelper.swift
//  AMICTR
//
//  Created by QFX on 2023/12/18.
//

import UIKit

class CommonHelper: NSObject {
    //日期 -> 字符串
    static func date2String(_ date:Date, dateFormat:String = "yyyy-MM-dd HH:mm:ss") -> String {
        let formatter = DateFormatter()
        formatter.dateFormat = dateFormat
        let date = formatter.string(from: date)
        return date
    }
    //字符串 -> 日期
    static func string2Date(_ string:String, dateFormat:String = "yyyy-MM-dd HH:mm:ss") -> Date {
        let formatter = DateFormatter()
        formatter.dateFormat = dateFormat
        let date = formatter.date(from: string)
        return date!
    }
}
